package com.reactim.common.response;

import lombok.Getter;

/**
 * 响应状态码枚举
 */
@Getter
public enum ResultCode {
    
    // 成功
    SUCCESS(200, "Success"),
    
    // 客户端错误
    BAD_REQUEST(400, "Bad Request"),
    UNAUTHORIZED(401, "Unauthorized"),
    FORBIDDEN(403, "Forbidden"),
    NOT_FOUND(404, "Not Found"),
    METHOD_NOT_ALLOWED(405, "Method Not Allowed"),
    CONFLICT(409, "Conflict"),
    UNPROCESSABLE_ENTITY(422, "Unprocessable Entity"),
    TOO_MANY_REQUESTS(429, "Too Many Requests"),
    
    // 服务器错误
    ERROR(500, "Internal Server Error"),
    BAD_GATEWAY(502, "Bad Gateway"),
    SERVICE_UNAVAILABLE(503, "Service Unavailable"),
    GATEWAY_TIMEOUT(504, "Gateway Timeout"),
    
    // 业务错误码
    USER_NOT_FOUND(1001, "User not found"),
    USER_ALREADY_EXISTS(1002, "User already exists"),
    INVALID_PASSWORD(1003, "Invalid password"),
    TOKEN_EXPIRED(1004, "Token expired"),
    TOKEN_INVALID(1005, "Token invalid"),
    
    MESSAGE_NOT_FOUND(2001, "Message not found"),
    MESSAGE_TOO_LARGE(2002, "Message too large"),
    MESSAGE_SEND_FAILED(2003, "Message send failed"),
    
    GROUP_NOT_FOUND(3001, "Group not found"),
    GROUP_ALREADY_EXISTS(3002, "Group already exists"),
    NOT_GROUP_MEMBER(3003, "Not group member"),
    INSUFFICIENT_PERMISSIONS(3004, "Insufficient permissions"),
    
    FILE_UPLOAD_FAILED(4001, "File upload failed"),
    FILE_NOT_FOUND(4002, "File not found"),
    FILE_TOO_LARGE(4003, "File too large"),
    UNSUPPORTED_FILE_TYPE(4004, "Unsupported file type");
    
    private final int code;
    private final String message;
    
    ResultCode(int code, String message) {
        this.code = code;
        this.message = message;
    }
}